<!DOCTYPE html>
<html lang="">

<head>
	<meta name="generator" content="Hugo 0.73.0" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="author" content="Ap Chen ">
<meta name="description" content="数据模型的定义 数据模型：数据特征的抽象 数据结构（数据模式） 数据操作 数据约束 四个世界 现实世界 概念世界 信息世界 计算机世界 概念模型 实体联系模型(E" />
<meta name="keywords" content="blog" />
<meta name="robots" content="noodp" />

<link rel="canonical" href="https://fziks.gitee.io/notes/database/2-%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B/" />

<meta itemprop="name" content="2-数据模型">
<meta itemprop="description" content="数据模型的定义 数据模型：数据特征的抽象 数据结构（数据模式） 数据操作 数据约束 四个世界 现实世界 概念世界 信息世界 计算机世界 概念模型 实体联系模型(E">
<meta itemprop="datePublished" content="2019-05-26T00:00:00&#43;00:00" />
<meta itemprop="dateModified" content="2019-05-26T00:00:00&#43;00:00" />
<meta itemprop="wordCount" content="888">



<meta itemprop="keywords" content="" />
<meta property="og:title" content="2-数据模型" />
<meta property="og:description" content="数据模型的定义 数据模型：数据特征的抽象 数据结构（数据模式） 数据操作 数据约束 四个世界 现实世界 概念世界 信息世界 计算机世界 概念模型 实体联系模型(E" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://fziks.gitee.io/notes/database/2-%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B/" />
<meta property="article:published_time" content="2019-05-26T00:00:00+00:00" />
<meta property="article:modified_time" content="2019-05-26T00:00:00+00:00" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="2-数据模型"/>
<meta name="twitter:description" content="数据模型的定义 数据模型：数据特征的抽象 数据结构（数据模式） 数据操作 数据约束 四个世界 现实世界 概念世界 信息世界 计算机世界 概念模型 实体联系模型(E"/>


<link rel="apple-touch-icon" sizes="60x60" href="https://fziks.gitee.io/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://fziks.gitee.io/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://fziks.gitee.io/icons/favicon-16x16.png">
<link rel="manifest" href="https://fziks.gitee.io/icons/site.webmanifest">
<link rel="mask-icon" href="https://fziks.gitee.io/icons/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://fziks.gitee.io/icons/favicon.ico">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-config" content="/icons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">

<title>2-数据模型</title>


<link rel="stylesheet" href="//at.alicdn.com/t/font_1559566_wk214kwa2dn.css">


    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">



    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css" integrity="sha256-WAgYcAck1C1/zEl5sBl5cfyhxtLgKGdpI3oKyJffVRI=" crossorigin="anonymous" />
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.css" integrity="sha256-a2tobsqlbgLsWs7ZVUGgP5IvWZsx8bTNQpzsqCSm5mk=" crossorigin="anonymous" />
    
   <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/materia/bootstrap.min.css" rel="stylesheet" integrity="sha384-1tymk6x9Y5K+OF0tlmG2fDRcn67QGzBkiM3IgtJ3VrtGrIi5ryhHjKjeeS60f1FA" crossorigin="anonymous">
    
    
    <link rel="stylesheet" href="https://fziks.gitee.io/sass/main_cdn.min.270b43bb8631af4497ed45b90db42c517e86c9511418de9152f134d02ed32b87.min.2192baea245cf318085511589e62bfbdb3fbe4fb0eef718f1be9af91c10542ce.css" integity="sha256-IZK66iRc8xgIVRFYnmK/vbP75PsO73GPG&#43;mvkcEFQs4=">

</head>

<body style="overflow-x: unset;">
	<div class="container-fluid">
		<div class="row d-print-block">
			<div class="col-12 col-md-3 col-lg-2 bd-sidebar d-print-none">
				<div class="d-flex mt-3 border-bottom">
        <span class="navbar-brand w-100" style="display: grid;">
            <small>
                <a href="https://fziks.gitee.io/" class="text-black-50">
                    <i class="iconfont icon-back-arrow-"></i>
                </a>
                Ap Chen's
            </small>
            <a class="text-dark" href="https://fziks.gitee.io/notes/">
                Notes
            </a>
        </span>
        <button class="btn btn-link text-dark d-md-none p-0 ml-3" type="button" data-toggle="collapse"
            data-target="#bd-docs-nav" aria-controls="bd-docs-nav" aria-expanded="true"
            aria-label="Toggle docs navigation">
            <i class="fad fa-bars"></i>
        </button>
    </div>
				<nav id="bd-docs-nav" class="collapse bd-links">
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/computer-network/">
            
            
                <span class="icontext">S</span>
            
            
            计算机网络
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/operating-system/">
            
            
                <span class="icontext">S</span>
            
            
            操作系统
        </a>
    </div>
    
    
    
    <div class="bd-toc-item active bg-light">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/database/">
            <i class="iconfont icon-back-arrow-reverse"></i>
            数据库
        </a>
        <ul class="nav bd-sidenav">
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/1-%E6%A6%82%E8%BF%B0/">1-概述</a>
            </li>
            
            
            
            <li class="active">
                <a href="https://fziks.gitee.io/notes/database/2-%E6%95%B0%E6%8D%AE%E6%A8%A1%E5%9E%8B/">
                    <i class="fad fa-chevron-right mr-1"></i>
                    2-数据模型
                </a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/3-%E5%85%B3%E7%B3%BB%E6%95%B0%E6%8D%AE%E5%BA%93%E7%B3%BB%E7%BB%9F/">3-关系数据库系统</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/8-%E8%A7%84%E8%8C%83%E5%8C%96%E7%90%86%E8%AE%BA/">8-规范化理论</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/5-%E5%AE%89%E5%85%A8%E6%80%A7%E4%B8%8E%E5%AE%8C%E6%95%B4%E6%80%A7/">5-安全性与完整性</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/6-%E4%BA%8B%E5%8A%A1%E5%A4%84%E7%90%86/">6-事务处理</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/7-%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84%E7%89%A9%E7%90%86%E7%BB%84%E7%BB%87/">7-数据库的物理组织</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/8-%E6%95%B0%E6%8D%AE%E4%BA%A4%E6%8D%A2/">8-数据交换</a>
            </li>
            
            
            
            <li>
                <a href="https://fziks.gitee.io/notes/database/9-%E6%95%B0%E6%8D%AE%E5%BA%93%E8%AE%BE%E8%AE%A1/">9-数据库设计</a>
            </li>
            
            
        </ul>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/cs50-introduction-to-computer-science/">
            
            
                <span class="icontext">S</span>
            
            
            CS50 MIT
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/advanced-programming/">
            
            
                <span class="icontext">A</span>
            
            
            高级程序设计
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/deep-learning/">
            
            
                <span class="icontext">O</span>
            
            
            深度学习基础
        </a>
    </div>
    
    
    
    <div class="bd-toc-item">
        <a class="bd-toc-link" href="https://fziks.gitee.io/notes/%E6%96%87%E7%8C%AE%E7%AE%A1%E7%90%86%E4%B8%8E%E4%BF%A1%E6%81%AF%E5%88%86%E6%9E%90/">
            
            
                <span class="icontext">O</span>
            
            
            文献管理与信息分析
        </a>
    </div>
    
    
</nav>
			</div>
			<div class="col-12 col-md-9 col-lg-10 d-print-block">
				<div class="row d-print-block">
					<main class="col-12 col-md-10 col-lg-9 py-md-3 pl-md-5 bd-content d-print-block" role="main">
						<div id="title" class="my-4 border-bottom">
							<span>数据库</span>
							<h2>2-数据模型</h2>
							<footer>
								<span>
									<i class="iconfont icon-NewFile mr-2"></i>
									2019-05-26 08:00 CST
								</span> <br />
								<span>
									<i class="iconfont icon-modify mr-2"></i>
									2019-05-26 08:00 CST
								</span> <br />
								<span>
									<i class="iconfont icon-copyright mr-2"></i>
									CC BY-NC 4.0
								</span>
							</footer>
						</div>
						<div id="content" class="hl-h2">
							
							
							
							
							
							
							
							
							
							
							
							
							<h2 id="数据模型的定义">数据模型的定义<a href="#数据模型的定义" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<ul>
<li>数据模型：数据特征的抽象
<ul>
<li>数据结构（数据模式）</li>
<li>数据操作</li>
<li>数据约束</li>
</ul>
</li>
<li>四个世界
<ul>
<li>现实世界</li>
<li>概念世界</li>
<li>信息世界</li>
<li>计算机世界</li>
</ul>
</li>
</ul>
<h2 id="概念模型">概念模型<a href="#概念模型" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<h3 id="实体联系模型e-r">实体联系模型(E-R)<a href="#实体联系模型e-r" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>实体(Entity)：实体名+实体型
<ul>
<li>实体集：具有共性的实体所构成的集合，实体集名+实体型+关键字</li>
<li>关键字：可用于区分同一个实体集中不同实体的 ‘最小属性集合’</li>
</ul>
</li>
<li>属性(Attribute)：属性名+域
<ul>
<li>域：某一属性可取的值的集合</li>
<li>实体型：所有属性的属性名</li>
<li>实体值：所有属性上的取值所构成的属性值的集合</li>
<li>具有共性的实体：实体型相同的实体</li>
</ul>
</li>
<li>联系：联系名+属性+函数对应关系
<ul>
<li>1:1, 1:m, m:n</li>
<li>二元联系，多元联系，单个实体集内部联系</li>
</ul>
</li>
<li>E-R 图
<ul>
<li>实体集：长方形</li>
<li>属性：椭圆</li>
<li>联系：菱形</li>
<li>连接：无向线段
<ul>
<li>实体集与属性</li>
<li>联系与属性</li>
<li>实体集与联系</li>
</ul>
</li>
</ul>
</li>
<li>E-R 模型设计
<ul>
<li>实体 or 属性</li>
<li>实体 or 联系</li>
<li>二元 or 三元</li>
<li>Event 可抽象为实体</li>
</ul>
</li>
</ul>
<h3 id="ee-r">EE-R<a href="#ee-r" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>IS-A 联系：超集-子集关系，单向箭头
<ul>
<li>继承性，传递性</li>
<li>覆盖约束
<ul>
<li>所有子实体集的并集等价于超实体集</li>
<li>一个实体至少隶属于某一个子实体集</li>
</ul>
</li>
<li>不相交约束
<ul>
<li>任意两个子实体集都是互不相交的</li>
<li>一个实体至多隶属于某一个子实体集</li>
</ul>
</li>
</ul>
</li>
<li>Weak Entity：需要依赖其它实体而存在的实体
<ul>
<li>多对一关系：弱实体到联系有向箭头</li>
</ul>
</li>
<li>属性划分
<ul>
<li>Identifier/key/candidate key</li>
<li>Descriptor</li>
<li>composite attribute：属性到属性无向线段</li>
<li>multi-value attribute：双实线</li>
</ul>
</li>
<li>属性基数 $(x,y)$
<ul>
<li>$x$: 是否必选 1/0</li>
<li>$y$: 是否单值 1/N</li>
</ul>
</li>
<li>实体在联系中的参与基数 card=(min-card, max-card)
<ul>
<li>min-card 1/0: 1 if all dots in the entity E have AT LEAST one line coming out
<ul>
<li>1: mandatory participation</li>
<li>0: optional participation</li>
</ul>
</li>
<li>max-card 1/N: 1 if all dots in the entity E have AT MOST one line coming out
<ul>
<li>1: single-valued</li>
<li>N: multi-valued</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="面向对象模型oo">面向对象模型(OO)<a href="#面向对象模型oo" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>对象(Object)
<ul>
<li>OID 对象标识符</li>
<li>静态特性/属性
<ul>
<li>多值</li>
</ul>
</li>
<li>动态特性/方法/操作</li>
</ul>
</li>
<li>类
<ul>
<li>具有相同属性方法的对象集合</li>
<li>类对象</li>
<li>元类：所有类对象的集合</li>
<li>实例：类中的对象</li>
<li>IS-A, IS-PART-OF</li>
</ul>
</li>
<li>消息：Type A.Op(O1, ..., On)</li>
</ul>
<h3 id="谓词模式">谓词模式<a href="#谓词模式" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>谓词：$P(x_1,\cdots,x_n)$
<ul>
<li>实体集：$n$ 个属性，$P(x_1,\cdots,x_n)=T$ if $(x_1,\cdots,x_n)\in R$</li>
<li>属性：约束变元 $C(x)$</li>
<li>联系：变元为实体</li>
<li>操作：$Op(x_1,\cdots, x_n, X)$</li>
<li>完整性约束</li>
</ul>
</li>
</ul>
<h2 id="逻辑模型">逻辑模型<a href="#逻辑模型" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<h3 id="关系模型">关系模型<a href="#关系模型" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h3>
<ul>
<li>二维表 Table
<ul>
<li>表框架：若干属性组成</li>
<li>Tuple/Row：一行数据</li>
</ul>
</li>
<li>关系：行列组成的二维表格</li>
<li>主关键字，外关键字</li>
<li>关系模式：关系的关系名及其属性名的集合构成该关系的关系模式</li>
</ul>
<h2 id="物理模型">物理模型<a href="#物理模型" class="anchor" aria-hidden="true"><i class="iconfont icon-link"></i></a></h2>
<ul>
<li>提高文件读写效率的方法
<ul>
<li>Index</li>
<li>Cluster</li>
<li>hash</li>
</ul>
</li>
</ul>

						</div>
					</main>
					<div class="d-none d-lg-block col-lg-3 bd-toc d-print-none">
						<div class="btn-group-vertical w-100 my-3">
    
    <a class="btn btn-outline-secondary text-dark w-100 p-2" href="https://list.html" target="_blank">
        <i class="iconfont icon-LC_icon_list_line"></i><br />待更新列表
    </a>
    

    
    <a class="btn btn-outline-secondary text-dark w-100 p-2" href="mailto:littlegreedy@qq.com"
        target="_blank">
        <i class="iconfont icon-discussion"></i><br />纠错与咨询
    </a>
    
    
    
    
        <a class="btn btn-outline-secondary text-dark w-100 p-2" href="#" onclick="window.print()">
            <i class="iconfont icon-dayin"></i><br />打印本页
        </a>
    
    
</div>
						<h4 class="card-title pb-0">目录</h4>
						<nav id="TableOfContents">
  <ul>
    <li><a href="#数据模型的定义">数据模型的定义</a></li>
    <li><a href="#概念模型">概念模型</a>
      <ul>
        <li><a href="#实体联系模型e-r">实体联系模型(E-R)</a></li>
        <li><a href="#ee-r">EE-R</a></li>
        <li><a href="#面向对象模型oo">面向对象模型(OO)</a></li>
        <li><a href="#谓词模式">谓词模式</a></li>
      </ul>
    </li>
    <li><a href="#逻辑模型">逻辑模型</a>
      <ul>
        <li><a href="#关系模型">关系模型</a></li>
      </ul>
    </li>
    <li><a href="#物理模型">物理模型</a></li>
  </ul>
</nav>
						
						
						<div id="disqus_thread"></div>
							<script>
							

							

							(function() { 
							var d = document, s = d.createElement('script');
							s.src = "https://"+"your site name on disqus"+".disqus.com/embed.js";
							s.setAttribute('data-timestamp', +new Date());
							(d.head || d.body).appendChild(s);
							})();
							</script>
							<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>                  
					  	</div>
						
					</div>
				</div>
			</div>
		</div>
	</div>

	<script
    src="https://code.jquery.com/jquery-3.4.1.min.js"
    integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
    crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script><script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>

<script type="text/javascript" src="https://fziks.gitee.io/custom.min.d3e1b7647f32dbe7e0140398739a26dad3f3470fc1eebe0741ef33668f1b7bd0b2917dc6efb9f0d9f1092b91dca502cab1b883863f02530133a8a8ef609926af.js" integrity="sha512-0&#43;G3ZH8y2&#43;fgFAOYc5om2tPzRw/B7r4HQe8zZo8be9CykX3G77nw2fEJK5HcpQLKsbiDhj8CUwEzqKjvYJkmrw=="></script>
<script type="text/javascript">

document.addEventListener("DOMContentLoaded", function () {
    renderMathInElement(
        document.body, {
            delimiters: [
                {
                    left: "$$",
                    right: "$$",
                    display: true
                },
                {
                    left: "\\[",
                    right: "\\]",
                    display: true
                },
                {
                    left: "$",
                    right: "$",
                    display: false
                },
                {
                    left: "\\(",
                    right: "\\)",
                    display: false
                }
            ],
            strict: false
        }
    );
});


$(document).on('click', 'a[href^="#"]', function (event) {
    event.preventDefault();

    $('html, body').animate({
        scrollTop: $($.attr(this, 'href')).offset().top
    }, 500);
});
</script>




</body>

</html>